import { request } from "@/utils/service"
import type * as Message from "./types/message"

/** 获取未读 */
export function getUnreadApi(recipientId: string) {
  return request<Message.IMessageResponseData>({
    url: "msg/getUnread",
    method: "get",
    params: {
      recipientId
    }
  })
}

/** 获取历史消息 */
export function geHistoryMsgApi(params: Message.IMessageRequestData) {
  return request<Message.IMessageResponseData>({
    url: "msg/historyMsg",
    method: "get",
    params
  })
}

/** 读取消息 */
export function readMsgApi(msgId: string) {
  return request<null>({
    url: "msg/readMsg",
    method: "put",
    params: {
      msgId
    }
  })
}

/** 获取历史消息 */
export function sendMsgApi(data: any) {
  return request<null>({
    url: "msg/sendMsg",
    method: "post",
    data
  })
}
